package com.ruoyi.article.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.article.domain.ZPraiseLog;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.article.mapper.ZLabelMapper;
import com.ruoyi.article.domain.ZLabel;
import com.ruoyi.article.service.IZLabelService;

/**
 * 标签Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-24
 */
@Service
public class ZLabelServiceImpl extends ServiceImpl<ZLabelMapper,ZLabel> implements IZLabelService
{
    @Autowired
    private ZLabelMapper zLabelMapper;

    /**
     * 查询标签
     * 
     * @param id 标签主键
     * @return 标签
     */
    @Override
    public ZLabel selectZLabelById(Long id)
    {
        return zLabelMapper.selectZLabelById(id);
    }

    /**
     * 查询标签列表
     * 
     * @param zLabel 标签
     * @return 标签
     */
    @Override
    public List<ZLabel> selectZLabelList(ZLabel zLabel)
    {
        return zLabelMapper.selectZLabelList(zLabel);
    }

    /**
     * 新增标签
     * 
     * @param zLabel 标签
     * @return 结果
     */
    @Override
    public int insertZLabel(ZLabel zLabel)
    {
        zLabel.setCreateTime(DateUtils.getNowDate());
        return zLabelMapper.insertZLabel(zLabel);
    }

    /**
     * 修改标签
     * 
     * @param zLabel 标签
     * @return 结果
     */
    @Override
    public int updateZLabel(ZLabel zLabel)
    {
        zLabel.setUpdateTime(DateUtils.getNowDate());
        return zLabelMapper.updateZLabel(zLabel);
    }

    /**
     * 批量删除标签
     * 
     * @param ids 需要删除的标签主键
     * @return 结果
     */
    @Override
    public int deleteZLabelByIds(Long[] ids)
    {
        return zLabelMapper.deleteZLabelByIds(ids);
    }

    /**
     * 删除标签信息
     * 
     * @param id 标签主键
     * @return 结果
     */
    @Override
    public int deleteZLabelById(Long id)
    {
        return zLabelMapper.deleteZLabelById(id);
    }

    @Override
    public List<ZLabel> getArticleLabel() {
        LambdaQueryWrapper<ZLabel> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ZLabel::getIsStart,0);
        List<ZLabel> list = list(queryWrapper);
        return list;
    }


}
